<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
	*{
		margin: 0;
		padding: 0;
	}
		.jd{
			width: 190px;
		    height: 260px;
		    color: #fff;
		    background-color: #e83632;
		    background-image: url(jddjs.png);
		    margin-top: 20px;
		    margin-left: 30%;
			text-align: center;
		}
		.jd h3{
		    font-size: 30px;
		    font-weight: 700;
		    padding-top: 31px;
		}
		.p1{
			padding-top: 90px;
			padding-bottom: 20px;
		}
		p span{
			display: inline-block;
			width: 30px;
    		height: 30px;
    		line-height: 30px;
    		background-color: #2f3430;
		}
	</style>
</head>
<body>
	<div class="jd">
		<h3>京东秒杀</h3>
		<p class="p1">倒计时</p>
		<p id="time_p">
			<span id="time_h">00</span>:
			<span id="time_m">00</span>:
			<span id="time_s">00</span>
		</p>
	</div>
<script>
var countdown = function(){
	var n_time = new Date('2019-09-06 10:00').getTime();
	var o_time = new Date().getTime();
	var ms = parseInt((n_time-o_time)/1000);
	var h = parseInt(ms/3600);
	var m = parseInt(ms/60)%60;
	var s = parseInt(ms%60);
	h = h<10 ? '0'+h : h;
	m = m<10 ? '0'+m : m;
	s = s<10 ? '0'+s : s;
	if (ms<=0) {
		clearInterval(count_time);
		time_p.innerHTML='秒杀结束';
	}else{
		time_h.innerHTML = h;
		time_m.innerHTML = m;
		time_s.innerHTML = s;
	}
}
var count_time = setInterval(countdown,1000);
countdown();
</script>
</body>
</html>